package com.tutucms.service.admin.configuration;

import com.tutucms.service.configuration.TuTuWebMvcConfig;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.servlet.config.annotation.CorsRegistry;

/**
 * @title:
 * @author: wangxudong
 * @date: 2019/5/29 12:58
 * @version: 1.0
 * @modified :
 */
@Configuration
@ControllerAdvice
public class MyWebMvcConfig extends TuTuWebMvcConfig {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
                .allowCredentials(true)
                .maxAge(3600)
                .allowedHeaders("*");
    }
}
